Skip to content

[appkit plugin] [6/x] Add bundled chat UI to @databricks/appkit-agent#391

Open
hubertzub-db wants to merge 14 commits intodatabricks:mainfrom
hubertzub-db:stack/agent-plugin-p6
Open

[appkit plugin] [6/x] Add bundled chat UI to @databricks/appkit-agent#391
hubertzub-db wants to merge 14 commits intodatabricks:mainfrom
hubertzub-db:stack/agent-plugin-p6

Conversation

@hubertzub-db
Copy link
Copy Markdown

@hubertzub-db hubertzub-db commented Mar 24, 2026

🥞 Stacked PR


Signed-off-by: Hubert Zub hubert.zub@databricks.com

Summary

Adds a pre-built React chat client to @databricks/appkit-agent, bundled into dist/chat-client/ during pnpm run build. The UI is served as static assets via the chat plugin — not exported as importable React components.

Important

This PR introduces UI pieces copied from e2e-chatbot-app-next that are used only for building a full bundle meant to be served by the appkit. Separate UI building blocks will be exported in latter PRs.

The client source is adapted from databricks/app-templates/e2e-chatbot-app-next/client, moved into integrations/appkit-agent/client/ as a self-contained Vite + React app with its own package.json and pnpm-lock.yaml.

How it works

The chat plugin exposes chat.staticAssetsPath which resolves to the dist/chat-client/ directory containing the built SPA. Pass it to AppKit's server plugin to serve the UI:

import { createApp } from "@databricks/appkit";
import { chat, agent } from "@databricks/appkit-agent";

const app = createApp({
  plugins: [
    server({ staticPath: chat.staticAssetsPath }),
    agent({}),
    chat({ backend: "agent" }),
  ],
});

Full demo (running as appkit app)

Screen.Recording.2026-03-25.at.11.36.45.mov

Copy link
Copy Markdown
Collaborator

@bbqiu bbqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with a few comments

// Handle query param auto-send (for ?query=... deep-links)
let searchParams: URLSearchParams | undefined;
try {
[searchParams] = useSearchParams();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we not be calling this hook from within this try/catch?

@@ -0,0 +1,221 @@
import type { LanguageModelUsage, UIMessageChunk } from 'ai';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to dedupe this file with chat.tsx?

],
"scripts": {
"build": "rm -rf dist && tsdown && tailwindcss -c tailwind.chat-ui.config.js -i src/chat-ui/simple/styles.css -o dist/chat-ui/styles.css --minify",
"build:client": "cd client && pnpm install --frozen-lockfile=false && pnpm exec vite build",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be frozen lockfile = true?

Comment on lines +60 to +66
if (typeof window !== 'undefined') {
window.__CHAT_CONFIG__ = { apiBase, basePath };
}

useEffect(() => {
window.__CHAT_CONFIG__ = { apiBase, basePath };
}, [apiBase, basePath]);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we use useLayoutEffect instead?

return dir;
}
}
return undefined;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we log an error explaining what's wrong and how the user might be able to resolve the error? ex. which command to run to generate these files

Move agent plugin source code into src/agent-plugin/ subfolder for
better organization when hosting multiple plugins.
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Add per-package pnpm-lock.yaml and CI/release workflows with
explicit pnpm version and cache-dependency-path.
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
@hubertzub-db hubertzub-db force-pushed the stack/agent-plugin-p6 branch from a312c62 to 5d750d9 Compare April 1, 2026 13:26
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
@hubertzub-db hubertzub-db force-pushed the stack/agent-plugin-p6 branch from 5d750d9 to a1b28f4 Compare April 1, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants